<?php

class Topic {

	public $id;
	
	public $title;
	
	public function Topic($id, $title) {
		$this->id = $id;
		$this->title = $title;
	}
	
	public static function newByJson($jsonString) {
		$obj = json_decode($jsonString, true); // true ... assoc
		
		return new Topic($obj['id'], $obj['title']);
	}
	
	public function __toString() {
		return "Topic[id=$this->id;title=$this->title]";
	}
}

?>